import Vue from 'vue'
import Router from 'vue-router'


import HomePage from '@/view/HomePage.vue'


Vue.use(Router)

let router = new Router({
    linkActiveClass: 'link-active',
    routes: [
        {
            path: '/',
            name: 'HomePage',
            component: HomePage,
            title: "首页",
            redirect: '/govIndexData',
            children: [
                {
                    path: '/govIndexData',
                    name: 'govIndex',
                    component: () => import( '@/view/government/juese1/index.vue'),
                    title: "大屏主页",
                    redirect: '/govIndexData/home',
                },
                {
                    path: '/tuanke',
                    name: 'tuanke',
                    component: () => import( '@/view/tuanke/index.vue'),
                    title: "tuanke"
                },
                {
                    path: '/shengtai',
                    name: 'shengtai',
                    component: () => import( '@/view/shengtai/index.vue'),
                    title: "shengtai"
                }
            ],
            
        },
        
    ]
})
// beforeRouteLeave(to, from, next) {
//     console.log("to", to);
//     console.log("from", from);
//     console.log("next", next);

//     next();
// },
// router.beforeEach((to, from, next) => {
    // console.log(to, 'to', from, 'from', next, 'next');

    // if (to.path.indexOf('login') > -1) {
    //     next()
    // } else {
    //     //如果进入政法委页面 根据登录保存的记录跳转地址
    //     if (to.path.indexOf('zhengfawei') > -1) {
    //         //获取登录后的记录值
    //         let LOGINTOKEN = window.sessionStorage.getItem('LOGINTOKEN') ? window.sessionStorage.getItem('LOGINTOKEN') : ''
    //         if (LOGINTOKEN + '' != '112') {
    //             next({ path: "/login" })
    //         } else {
    //             next()
    //         }

    //     } else {
    //         next();
    //     }
    // }

    // NProgress.start()
    // if (to.path.indexOf('login') > -1) {
    //     next()
    // } else {
    //     let LOGINTOKEN = window.sessionStorage.getItem('LOGINTOKEN') ? window.sessionStorage.getItem('LOGINTOKEN') : ''
    //     if (LOGINTOKEN + '' != '112') {
    //         // this.$router.push({ path: "/login" });
    //         next({ path: "/login" })
    //         // window.location.href = "/#/login"

    //     } else {
    //         next()
    //     }
    // }
// })

export default router;
